<!DOCTYPE html>
<html lang="en">
<head>
  <title></title>
  <script type="text/javascript" src="../internal.js"></script>
  <style>
    #select-list input{
      display: inline-block;
      width: 100px;
    }
  </style>
</head>
<body>
<div>
  <span>可用变量</span>
  <select id="inputCode">
    <option value="">无</option>
    <option value="companyName">当前用户公司</option>
  </select>
  <button onclick="submit()">确定</button>
</div>
</body>
<script>
  function submit(){
    var id = 'span' + Math.random().toString().slice(-10);
    var selectObj = document.getElementById('inputCode');
    var code = selectObj.value;
    var text = selectObj.options[selectObj.selectedIndex].text;
    var style = 'background-color: hsla(220,4%,58%,.1);'+
    'border-color: hsla(220,4%,58%,.2);'+
    'color: #909399;'+
    'background-color: rgba(64,158,255,.1);'+
    'display: inline-block;'+
    'padding: 0 10px;'+
    'height: 32px;'+
    'line-height: 30px;'+
    'font-size: 12px;'+
    'border-radius: 4px;'+
    'box-sizing: border-box;'+
    'border: 1px solid rgba(64,158,255,.2);'+
    'width: 180px;'+
    'white-space: nowrap;';
    
    var str = '<span class="ue-tag" style="'+style+'" id="' + id + '">'+text+'</span>';
    editor.execCommand('insertHtml',str, true);
    editor.elList.push({
        elId: id,
        elType: 'span',
        elField: code
    });
    dialog.popup.hide();
  }
</script>
</html>
